package cn.org.eshow.service.impl;

import cn.org.eshow.bean.query.ProductOrderSummaryQuery;
import cn.org.eshow.common.page.Page;
import cn.org.eshow.dao.ProductOrderSummaryDao;
import cn.org.eshow.model.ProductOrderSummary;
import cn.org.eshow.service.ProductOrderSummaryManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.jws.WebService;
import java.util.List;

@WebService(serviceName = "ProductOrderSummaryService", endpointInterface = "cn.org.eshow.service.ProductOrderSummaryManager")
@Service
public class ProductOrderSummaryManagerImpl extends GenericManagerImpl<ProductOrderSummary, Integer> implements ProductOrderSummaryManager {

    @Autowired
    ProductOrderSummaryDao rechargeSummaryDao;

    public ProductOrderSummaryManagerImpl() {
    }

    @Autowired
    public ProductOrderSummaryManagerImpl(ProductOrderSummaryDao rechargeSummaryDao) {
        super(rechargeSummaryDao);
        this.rechargeSummaryDao = rechargeSummaryDao;
    }

    @Override
    public List<ProductOrderSummary> list(ProductOrderSummaryQuery query) {
        return rechargeSummaryDao.list(query);
    }

    @Override
    public Page<ProductOrderSummary> search(ProductOrderSummaryQuery query) {
        return rechargeSummaryDao.search(query);
    }

    @Override
    public ProductOrderSummary check(ProductOrderSummaryQuery query) {
        List<ProductOrderSummary> list = rechargeSummaryDao.list(query);
        if (!list.isEmpty()) {
            return list.get(0);
        }
        return null;
    }
}